import { GuideArrow } from "../view/guide/GuideArrow";
type int = number;
//class GuideArrowManager
    
    export  class GuideArrowManager
    {
        

        public static get guideArrow(): GuideArrow
        {
            return GuideArrowManager._guideArrow;
        }

        public static get dialogArrow(): GuideArrow
        {
            return GuideArrowManager._dialogArrow;
        }

        public static getGuideArrow(arg1: int, arg2: Function=null, arg3: int=20000, arg4: Object=null): GuideArrow
        {
            GuideArrowManager.hideGuideArrow();
            GuideArrowManager._guideArrow.updateDir(arg1);
            if (arg3 > 0) 
            {
                GuideArrowManager._timerKey = flash.utils.setTimeout(GuideArrowManager.onTimerOut, arg3);
            }
            if (arg2 != null) 
            {
                GuideArrowManager._onDelay = arg2;
                if (arg4) 
                {
                    GuideArrowManager._params = arg4;
                }
            }
            return GuideArrowManager._guideArrow;
        }

        public static getDialogGuideArrow(arg1: int): GuideArrow
        {
            GuideArrowManager.hideDialogArrow();
            GuideArrowManager._dialogArrow.updateDir(arg1);
            return GuideArrowManager._dialogArrow;
        }

        public static showGuideArrowAtLayer(arg1: Object /* flash.display.DisplayObjectContainer */, arg2: int, arg3: int, arg4: int, arg5: Function=null, arg6: int=20000): void
        {
            var loc1;
            (loc1 = GuideArrowManager.getGuideArrow(arg4, arg5, arg6)).x = arg2;
            loc1.y = arg3;
            arg1.addChild(loc1);
            return;
        }

        /* internal  */static onTimerOut(): void
        {
            if (GuideArrowManager._onDelay != null) 
            {
                if (GuideArrowManager._params) 
                {
                    GuideArrowManager._onDelay(GuideArrowManager._params);
                }
                else 
                {
                    GuideArrowManager._onDelay();
                }
            }
            GuideArrowManager.hideGuideArrow();
            return;
        }

        /* internal  */static clearTimer(): void
        {
            flash.utils.clearTimeout(GuideArrowManager._timerKey);
            GuideArrowManager._onDelay = null;
            GuideArrowManager._params = null;
            return;
        }

        public static hideGuideArrow(): void
        {
            GuideArrowManager.clearTimer();
            if (GuideArrowManager._guideArrow.parent != GuideArrowManager._thumbParent) 
            {
                GuideArrowManager._thumbParent.addChild(GuideArrowManager._guideArrow);
                GuideArrowManager._guideArrow.dispose();
            }
            return;
        }

        public static hideDialogArrow(): void
        {
            if (GuideArrowManager._dialogArrow.parent != GuideArrowManager._thumbParent) 
            {
                GuideArrowManager._thumbParent.addChild(GuideArrowManager._dialogArrow);
                GuideArrowManager._dialogArrow.dispose();
            }
            return;
        }

        public static stageResize(): void
        {
            if (GuideArrowManager._guideArrow && !(GuideArrowManager._guideArrow.parent == GuideArrowManager._thumbParent)) 
            {
                if (GuideArrowManager._guideArrow.baseLayer) 
                {
                    GuideArrowManager._guideArrow.x = GuideArrowManager._guideArrow.baseX + GuideArrowManager._guideArrow.baseLayer.x;
                    GuideArrowManager._guideArrow.y = GuideArrowManager._guideArrow.baseY + GuideArrowManager._guideArrow.baseLayer.y;
                }
            }
            return;
        }

        public static /* const */Dir_T: int=5;

        public static /* const */Dir_B: int=6;

        public static /* const */Dir_L: int=7;

        public static /* const */Dir_R: int=8;

        /* internal */ static /* var */_guideArrow: GuideArrow;

        /* internal */ static /* var */_dialogArrow: GuideArrow;

        /* internal */ static /* var */_timerKey: uint;

        /* internal */ static /* var */_onDelay: Function;

        /* internal */ static /* var */_params: Object;

        /* internal */ static /* var */_thumbParent: Object /* flash.display.Sprite */;
    }

            GuideArrowManager._guideArrow = new GuideArrow();
            GuideArrowManager._dialogArrow = new GuideArrow();
            GuideArrowManager._thumbParent = new Object /* flash.display.Sprite */();
        